# vim: filetype=yaml sw=2
filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
version: 7.3.0
var:
  container:
    use_container: 1
  glibc_version: 2.25
  linux_version: 4.10.1
  deps:
    - build-essential
    - libmpc-dev
    - hardening-wrapper
    - libc6-dev-i386
    - gawk
  setup: |
    [% c("var/setarch") -%]
    mkdir -p /var/tmp/dist
    tar -C /var/tmp/dist -xf $rootdir/[% c("compiler_tarfile") %]
    export PATH="/var/tmp/dist/gcc-cross/bin:$PATH"
    #export LD_LIBRARY_PATH=/var/tmp/dist/gcc-cross/lib

    [% IF c("hardened_gcc") -%]
      # Config options for hardening-wrapper
      export DEB_BUILD_HARDENING=1
      export DEB_BUILD_HARDENING_STACKPROTECTOR=1
      export DEB_BUILD_HARDENING_FORTIFY=1
      export DEB_BUILD_HARDENING_FORMAT=1
      export DEB_BUILD_HARDENING_PIE=1

      # Make sure we use the hardening wrapper
      pushd /var/tmp/dist/gcc-cross/bin
      cp /usr/bin/hardened-cc ./
      mv [% c('var/gcc_target') %]-gcc [% c('var/gcc_target') %]-gcc.real
      mv [% c('var/gcc_target') %]-c++ [% c('var/gcc_target') %]-c++.real
      mv [% c('var/gcc_target') %]-g++ [% c('var/gcc_target') %]-g++.real
      ln -sf hardened-cc [% c('var/gcc_target') %]-gcc
      ln -sf hardened-cc [% c('var/gcc_target') %]-c++
      ln -sf hardened-cc [% c('var/gcc_target') %]-g++
      popd
    [% END -%]

targets:
  linux:
    hardened_gcc: 1
  linux-arm:
    var:
      configure_opt: --disable-multilib --enable-languages=c,c++ --target=[% c("var/gcc_target") %] --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb
input_files:
  - project: container-image
  - URL: 'https://ftp.gnu.org/gnu/gcc/gcc-[% c("version") %]/gcc-[% c("version") %].tar.xz'
    sha256sum: 832ca6ae04636adbb430e865a1451adf6979ab44ca1c8374f61fba65645ce15c
  - name: binutils
    project: binutils
  - URL: 'https://ftp.gnu.org/gnu/glibc/glibc-[% c("var/glibc_version") %].tar.xz'
    sha256sum: 067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0
  - URL: 'https://www.kernel.org/pub/linux/kernel/v4.x/linux-[% c("var/linux_version") %].tar.xz'
    sha256sum: 6ca06bb5faf5f83600d7388bb623dae41df2a257de85ad5d1792e03302bc3543
  - filename: sourceware_bz_21666.patch
